package cxm.proj.sms;

import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Shader;
import android.graphics.Shader.TileMode;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import cxm.com.util.MyLog;

public class InfoFragment extends Fragment {
	@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.layout_info, container, false);

        TextView textView = (TextView)view.findViewById(R.id.text_version);
        // get version to set
        try {
	        PackageInfo manager = this.getActivity().getPackageManager().getPackageInfo(
	    			this.getActivity().getPackageName(), 0);
	        textView.setText(this.getActivity().getString(R.string.info_version) +
	        		manager.versionName);
        } catch (Exception e) {
        	MyLog.Log(MyLog.Level.Error, "Cannot find package name :" + e);
        }

        // get text size

        // set gradient color for text view
        textView = (TextView)view.findViewById(R.id.text_title);
        Shader textShader=new LinearGradient(0, 0, 0, 50,
                new int[]{Color.WHITE, Color.rgb(131, 137, 150), Color.WHITE},
                new float[]{0.3f, 0.5f, 0.7f}, TileMode.CLAMP);
        textView.getPaint().setShader(textShader);
        
        return view;
    }
}
